package com.thinkgem.dingdan.modules.sys.service;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.thinkgem.dingdan.common.service.BaseService;
import com.thinkgem.dingdan.modules.sys.dao.UserDao;
import com.thinkgem.dingdan.modules.sys.entity.User;

@Service
@Transactional(readOnly = true)
public class UserServiceImpl extends BaseService implements IUserService {

	@Resource
	private UserDao userDao;

	@Override
	public List<?> findList(User user) {
		// 生成数据权限过滤条件（dsf为dataScopeFilter的简写，在xml中使用 ${sqlMap.dsf}调用权限SQL）
		user.getSqlMap().put("dsf", dataScopeFilter(user.getCurrentUser(), "o", "a"));
		// 执行分页查询
		List<User> list = userDao.findList(user);
		return list;
	}

	@Override
	public List<User> findRef(User user) {
		return userDao.findRef(user);
	}

	@Override
	public List<User> findRefRole(User user) {
		return userDao.findRefRole(user);
	}

	@Override
	public User get(String id) {
		return userDao.get(id);
	}

}
